Json Manager¶
-
class
json_justify.jason.
JsonManager
(data, allow_extra=False, _child_hook=False)¶ This is the main json field which ultimately any progarm will subclass to make it possible to create Json classes
Parameters: - data – data to validate
- allow_extra – If extra fields allowed or not
- hook (_child) – If it is Child or not
-
Object
¶ alias of
__builtin__.dict
-
add_render_machiene
(func)¶ This is used to regester function for rendering if param is not callable then it will raise InvalidContainer
Parameters: func – Returns: None
-
child
¶ This property is used to check that if it is child json or not
Returns: True or False
-
generate_otk_token
()¶ This function is a dummy function which may be used to crete dummy functions for another projects
Returns:
-
integral_types
(data)¶ This is used to check if field data is in integral types or not
Parameters: data (any) – value to chaeck
-
is_object
(value)¶ This class is used to check if it is dir which is standard key value pair or not
Parameters: value – directory Returns: True or False
-
is_valid
()¶ This is used to check if data provided to JsonManager is actually valid or not Following Things Will be checked – Data type corrospondence – Good with validators
Returns: True or False
-
items
()¶ This method should be used to get all of the Field class keys inside JsonManager Class
Returns: a list of Field
-
json_or_error
()¶ json_or_error function should be to get json or error -json and returned to system and then rendered accordingly
Returns: dict of error or render
-
regester_attris
(func)¶ This is used to regester function which will be called on creation of class if param is not callable then it will raise InvalidMachiene
Parameters: func – Callable function which returns tuple of key value pair or return value if function name you want to be key name Returns: None
-
regester_error
(name, value)¶ This is used to regester error to the object and used to regester validation Error
Parameters: - name – name of error
- value – value of error
-
render_json
()¶ This function is used as a master key to create json with registered rendered function and send it back as response
Returns: dict(Kind of Json)
-
setup_fields
()¶ This method filters out and setup field dictionary to work creates field dictionary and returns it
Returns: a dictionary of fields
-
setup_json
()¶ This is function which will be used to setup form if data and if not provided in any of its instances then it will register error
Raises: Invalid if not valid data